package com.situ.web.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class Cookie1Servlet
 */
@WebServlet("/Cookie1Servlet")
public class Cookie1Servlet extends HttpServlet {
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		System.out.println("Cookie.service");
		String goodsName = req.getParameter("goods");
		Cookie cookie1 = new Cookie("goods","iphone");
		cookie1.setMaxAge(10 * 60);
		Cookie cookie2 = new Cookie("name", "zhangsan");
		resp.addCookie(cookie1);
		resp.addCookie(cookie2);
	}
}
